package com.coachtam.sjcar.service;


import com.coachtam.sjcar.mapper.RouteMapper;
import com.coachtam.sjcar.pojo.Route;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * @Copyright (C), 2018-2019
 * @Author: JAVA在召唤
 * @Date: 2019-09-12 16:38
 * @Description:
 */
@Service
public class RouteService {
    @Autowired
    private RouteMapper routeMapper;

    public List<Route> findNewest() {
        PageHelper.startPage(0, 20);
        Example example = new Example(Route.class);
        example.orderBy("publishDate").desc();
        return routeMapper.selectByExample(example);
    }
}
